<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>融资融券交易终端</title>
		<meta name="renderer" content="webkit">
  		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  		<!-- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> -->
		<link rel="stylesheet" type="text/css" href="<?php echo STATIC_SERVER; ?>/layui/css/layui.css">
		<link rel="stylesheet" type="text/css" href="<?php echo STATIC_SERVER; ?>/home/css/style.css"/>
	</head>
	<body>
		<div class="xinsu-login">
			<div class="xinsu-login-top">
				<div class="xinsu-login-top-con">
					<img class="xinsu-login-top-title" width="252" height="29" src="<?php echo STATIC_SERVER; ?>/home/img/login_title_03.png" />
					<div class="xinsu-login-nav">
						<a class="xinsu-login-back" href="javascript:;" target="_index">返回首页</a>
						<a href="javascript:;">预约开户</a>
					</div>
				</div>
			</div>
			<div class="xinsu-login-content">
				<div class="xinsu-login-pic">
					<img width="333" height="270" src="<?php echo STATIC_SERVER; ?>/home/img/login_p01.png" />
					<img class="xinsu-login-combg" src="<?php echo STATIC_SERVER; ?>/home/img/com_bg_03.png" />
				</div>
				<form class="xinsu-login-form" action="" method="post">
					<h2>客户登录</h2>
					<div class="layui-form">
						<div class="layui-form-item">
							<input type="text" name="username" class="layui-input" value="" placeholder="请输入账号" />
							<input type="password" name="password" class="layui-input" value="" placeholder="请输入密码" />
							<input type="text" name="code" class="layui-input xinsu-login-input" value="" placeholder="请输入验证码" />
							<img src="/user/verify" id="verify" onclick="refresh()" />
							<div class="xinsu-clear"></div>
						</div>
						<button class="layui-btn" type="submit">登录</button>
					</div>
				</form>
				<div class="xinsu-clear"></div>
			</div>
		</div>
	</body>
	<script src="<?php echo STATIC_SERVER; ?>/home/js/jquery-1.12.1.min.js"></script>
	<script src="<?php echo STATIC_SERVER; ?>/layui/layui.all.js"></script>
	<script language='JavaScript' type="text/javascript">
		//登录
		$("form").submit(function(){
			var data = $(this).serialize();
			$.ajax({
				type:'post',  
				url : "/user/login",
				dataType : 'json',
				data : data,
				success : function(repones) {
					if (repones.status == 1 || repones.status == 2) {
						layer.msg('登录成功', {icon: 1, time: 800}, function(){
							location.href = "/stock";
						});
					} else {
						refresh();
						layer.msg(repones.msg);return false;
					}
				},
				error : function() {
					refresh();				
					layer.msg('加载数据失败，请重新加载');return false;
				}
			});
			return false;
		})
		
		//刷新验证码
		function refresh() {
			$('#verify').attr("src", "/user/verify?t=" + Math.random());
		}
	</script>
</html>
